#ifndef _node_h_included_
#define _node_h_included_
#include <d3dx9.h>
#include <d3d9.h>
#include <string>
#include <Vector>
#include "Game.h"
#include "Model.h"
#include "ModelPrimitive.h"
#include <D3dx9math.h>

using namespace std;

class Model;
class Node;

//This class is responsible for maintaining the state
//of a model
class Node
{
	protected:
	string* mName;
	vector<Node*> * mJoints;
	D3DXVECTOR3* mOffset;
	Model* mModel;
	

	int mNumOfChannels;
	int* mChannels;

	static const int mMaxChannels = 6;
	float* mChannelValue;

	vector<vector<float>*>* mFrames;
	

public:
	
	static int mFrame;

	enum Channel{
		zRot = 0,
		yRot = 1,
		xRot = 2,
		zTrans = 3,
		yTrans = 4,
		xTrans = 5,
	};
	
	Node();

	void SetName(string* pName){mName = pName;}
	string* GetName(){return mName;}

	void SetModel(Model* pModel){mModel = pModel;}
	Model* GetModel(){return mModel;}

	void SetJoints(vector<Node*> * pJoints){mJoints = pJoints;}
	vector<Node*>* GetJoints(){return mJoints;}

	void SetFrames(vector<vector<float>*>* pFrames){mFrames = pFrames;}
	vector<vector<float>*>* GetFrames(){return mFrames;}

	void SetNumOfChannels(int pNum){mNumOfChannels = pNum; mChannels = new int[mNumOfChannels];}
	int GetNumOfChannels(){return mNumOfChannels;}

	void SetChannels(int* pChannels){mChannels = pChannels;}
	int* GetChannels(){return mChannels;}

	void SetChannelValue(float* pChanVal){mChannelValue = pChanVal;}
	float* GetChannelValue(){return mChannelValue;}

	void SetOffset(D3DXVECTOR3* pOffset){mOffset = pOffset;}
	D3DXVECTOR3* GetOffset(){return mOffset;}



	void Update(float pElapsedTime);
	void Draw(LPDIRECT3DDEVICE9 d3ddev,LPD3DXMATRIXSTACK pStack);
};
#endif
